#include "contactform.h"
#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QTextEdit>
#include <QPushButton>
#include <QtGui/QGridLayout>
#include <QDataWidgetMapper>

ContactForm::ContactForm(QWidget *parent)
        : QWidget(parent)
{
    /* DIALOG DISPLAY PREFS */

    /* WIDGETS*/
    QLabel *nameLabel = new QLabel(tr("Name:"));
    nameLine = new QLineEdit;
    nameLabel->setBuddy(nameLine);

    QLabel *numberLabel = new QLabel(tr("Number:"));
    numberLine = new QLineEdit;
    numberLabel->setBuddy(numberLine);

    QLabel *emailLabel = new QLabel(tr("Email:"));
    emailLine = new QLineEdit;
    emailLabel->setBuddy(emailLine);

    QLabel *tagsLabel = new QLabel(tr("Tags:"));
    tagsText = new QTextEdit();
    tagsLabel->setBuddy(tagsText);

    QPushButton *cancelButton = new QPushButton(tr("Cancel"));
    QPushButton *okButton = new QPushButton(tr("Submit"));

    /*SLOTS/SIGNALS*/
    connect(cancelButton,   SIGNAL(clicked()),
            this,           SIGNAL(reject()));
    connect(okButton,       SIGNAL(clicked()),
            this,           SIGNAL(accept()));

    //LAYOUT
    QGridLayout *formLayout = new QGridLayout;
    formLayout->addWidget(nameLabel,0,0);
    formLayout->addWidget(nameLine,0,1);
    formLayout->addWidget(numberLabel,1,0);
    formLayout->addWidget(numberLine,1,1);
    formLayout->addWidget(numberLabel,1,0);
    formLayout->addWidget(numberLine,1,1);
    formLayout->addWidget(emailLabel,2,0);
    formLayout->addWidget(emailLine,2,1);
    formLayout->addWidget(cancelButton,1,2);
    formLayout->addWidget(okButton,2,2);
    setLayout(formLayout);
}
